package com.lyj.mode.adapter.interfaceAdapter;

/**
 * 手机充电适配器
 * @author:liyajie
 * @createTime:2022/2/17 21:45
 * @version:1.0
 */
public class PhoneAdapter extends DefaultAdapter {

    private Ac ac;

    public PhoneAdapter(Ac ac){
        this.ac = ac;
    }

    @Override
    public int outputDc() {
        // 获取220V交流电
        int srcV = ac.outputAc();
        // 模拟适配器过程，转换为5v直流电
        int targetV = srcV / 44;
        System.out.println("电压已经适配为" + targetV + "V" );
        return targetV;
    }
}
